package com.hmdp.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedissonConfig {
    @Bean(name = "redissonClient")
    public RedissonClient redisson() {
        Config config = new Config();
        config.useSingleServer().setAddress("redis://localhost:6379");
        return Redisson.create(config);
    }

    @Bean(name = "redissonClient2")
    public RedissonClient redisson2() {
        Config config = new Config();
        config.useSingleServer().setAddress("redis://193.112.105.193:6379").setPassword("123456");
        return Redisson.create(config);
    }

//    @Bean(name = "redissonClient3")
//    public RedissonClient redisson3() {
//        Config config = new Config();
//        config.useSingleServer().setAddress("redis://ctwh.chunmai.de:19095");
//        return Redisson.create(config);
//    }
}
